﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.XPath;

using GaugeEngine.Graphics;

namespace GaugeEngine.Behaviours
{
    public class Drawable : Behaviour
    {
        private Sprite m_sprite;

        public Drawable(Actor a, Sprite s) : base(a)
        {
            m_sprite = s;
        }

        public override void Draw(Painter p)
        {
            p.DrawSprite(ParentActor.Position, m_sprite);
        }

        public static Behaviour CreateDrawable(Game g, Actor a, XPathNavigator xnav)
        {
            string imageloc = xnav.GetAttribute("imagelocation", "");
            Sprite s = ContentFactory.LoadSprite(imageloc);
            return new Behaviours.Drawable(a, s);
        }
    }
}
